import request from "@/utils/request";
import { AxiosPromise } from "axios";
import { SysConfigForm, SysConfigVO } from "@/api/config/types";


export function query(): AxiosPromise<SysConfigVO[]> {
  return request({
    url: "/api/v1/config",
    method: "get",
  });
}

export function openOrClose(id: number, configSwitch:number): AxiosPromise<any> {
  return request({
    url: `/api/v1/config/${id}/${configSwitch}` ,
    method: "put",
  });
}
export function updateConfig(id: number, data: SysConfigForm): AxiosPromise<any> {
  return request({
    url: "/api/v1/config/" + id,
    method: "put",
    data: data,
  });
}
export function saveConfig(data: SysConfigForm): AxiosPromise<any> {
  return request({
    url: "/api/v1/config",
    method: "post",
    data: data,
  });
}


